Minimum Window Substring
Hard
Question
Return the shortest substring of input
that has all the characters given in match
.
If there are no matches, then return an empty string.
Input: input = "acabaa", match = "bc"
Output: "cab"
Input: input = "aabbccddee", match = "abcab"
Output: "aabbc"
Input: input = "abc", match = "dab"
Output: ""
There is no substring that has all the characters in match
.
Clarify the problem
What are some questions you'd ask an interviewer?
Understand the problem
What is the shortest substring of "catmagicmcdog" that contains all the characters in "mac"?
3
4
5
6
All test cases pass! 🎉
Time limit exceeded
InputExpected OutputActual Output
Standard OutputScroll down...
Login or signup to save your code.
Uh oh... looks like you don't yet have access.
Not sure what this unlocks? Check out a free pattern section.